export const catagoryData = [
  {
    label: '物料类别编码',
    searchLabelWidth: 150,
    prop: 'code',
    searchOrder: 1,
    search: true,
    searchSpan: 6,
    addDisplay: false,
    disabled: true,
    rules: [
      {
        required: true,
        message: '请输入物料类别编码',
        trigger: 'blur'
      }
    ],
    formatter: (val) => {
      return val.partCategoryCode;
    }
  },
  {
    label: '物料类别名称',
    searchLabelWidth: 150,
    prop: 'name',
    search: true,
    searchOrder: 2,
    disabled: true,
    addDisplay: false,
    searchSpan: 6,
    rules: [
      {
        required: true,
        message: '请输入物料类别名称',
        trigger: 'blur'
      }
    ],
    formatter: (val) => {
      return val.partCategoryName;
    }
  },
  {
    label: '规则类型',
    prop: 'ruleSchemeType',
    searchLabelWidth: 150,
    dicUrl: '/api/mes-warehouse/rule-scheme/get-rule-type',
    props: {
      label: 'value',
      value: 'value'
    },
    dicFormatter: (res) => {
      return res.data;
    },
    type: 'select',
    searchSpan: 6,
    searchOrder: 5,
    search: true,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,

    hide: true,
    rules: [
      {
        required: true,
        message: '请选择规则类型',
        trigger: 'blur'
      }
    ]
  },
  {
    label: '已配规则分类',
    prop: 'schemeNameStr',
    searchLabelWidth: 150,
    searchSpan: 6,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,
    rules: [
      {
        required: true,
        message: '请输入规则名称',
        trigger: 'blur'
      }
    ]
  },
  {
    label: '规则名称',
    prop: 'ruleSchemeName',
    search: true,
    searchOrder: 4,
    type: 'select',
    searchLabelWidth: 150,
    searchSpan: 6,
    disabled: true,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,
    hide: true,
    dicData: [
      {
        label: '保质期天数',
        value: '保质期天数'
      },
      {
        label: '保质期预警天数',
        value: '保质期预警天数'
      },
      {
        label: '超收规则',
        value: '超收规则'
      },
      {
        label: '先进先出',
        value: '先进先出'
      },
      {
        label: '超领管控',
        value: '超领管控'
      }
    ]
  },
  {
    label: '',
    prop: 'rulesContent',
    labelWidth: 0,
    span: 24,
    hide: true,
    formslot: true
  },
  {
    label: '是否已配规则',
    searchLabelWidth: 150,
    prop: 'isConfigRule',
    searchOrder: 3,
    type: 'select',
    searchSpan: 6,
    search: true,
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false,
    dicData: [
      { label: '是', value: true },
      { label: '否', value: false }
    ]
  },
  {
    label: '更新人',
    prop: 'updateUserName',
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false
  },
  {
    label: '最新更新时间',
    prop: 'updateTime',
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false
  }
];

export const marterialData = [
  {
    label: '物料类别编码',
    prop: 'partCategoryCode',
    addDisplay: false,
    editDisplay: false
  },
  {
    label: '物料类别名称',
    prop: 'partCategoryName',
    addDisplay: false,
    editDisplay: false
  },
  {
    label: '物料编码',
    searchLabelWidth: 150,
    prop: 'code',
    searchOrder: 1,
    search: true,
    searchSpan: 6,
    addDisplay: false,
    disabled: true,
    rules: [
      {
        required: true,
        message: '请输入物料编码',
        trigger: 'blur'
      }
    ],
    formatter: (val) => {
      return val.partMasterCode;
    }
  },
  {
    label: '物料名称',
    searchLabelWidth: 150,
    prop: 'name',
    search: true,
    searchOrder: 2,
    disabled: true,
    addDisplay: false,
    searchSpan: 6,
    rules: [
      {
        required: true,
        message: '请输入物料名称',
        trigger: 'blur'
      }
    ],
    formatter: (val) => {
      return val.partMasterName;
    }
  },
  {
    label: '规则类型',
    prop: 'ruleSchemeType',
    searchLabelWidth: 150,
    dicUrl: '/api/mes-warehouse/rule-scheme/get-rule-type',
    props: {
      label: 'value',
      value: 'value'
    },
    dicFormatter: (res) => {
      return res.data;
    },
    type: 'select',
    searchSpan: 6,
    searchOrder: 5,
    search: true,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,
    hide: true,
    rules: [
      {
        required: true,
        message: '请选择规则类型',
        trigger: 'blur'
      }
    ]
  },
  {
    label: '已配规则分类',
    prop: 'schemeNameStr',
    searchLabelWidth: 150,
    searchSpan: 6,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,
    rules: [
      {
        required: true,
        message: '请输入规则名称',
        trigger: 'blur'
      }
    ]
  },
  {
    label: '规则名称',
    prop: 'ruleSchemeName',
    search: true,
    searchOrder: 4,
    type: 'select',
    searchLabelWidth: 150,
    searchSpan: 6,
    disabled: true,
    editDisplay: false,
    viewDisplay: false,
    addDisplay: false,
    hide: true,
    dicData: [
      {
        label: '保质期天数',
        value: 'STORAGE_TIME'
      },
      {
        label: '保质期预警天数',
        value: 'STORAGE_WARNING_TIME'
      },
      {
        label: '超收规则',
        value: 'OVER_LIMIT'
      },
      {
        label: '先进先出',
        value: 'FIFO'
      },
      {
        label: '超领管控',
        value: 'OVER_RECEIVE'
      }
    ]
  },
  {
    label: '',
    prop: 'rulesContent',
    labelWidth: 0,
    span: 24,
    hide: true,
    formslot: true
  },
  {
    label: '是否已配规则',
    searchLabelWidth: 150,
    prop: 'isConfigRule',
    searchOrder: 3,
    type: 'select',
    searchSpan: 6,
    search: true,
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false,
    dicData: [
      { label: '是', value: true },
      { label: '否', value: false }
    ]
  },
  {
    label: '更新人',
    prop: 'updateUserName',
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false
  },
  {
    label: '最新更新时间',
    prop: 'updateTime',
    addDisplay: false,
    viewDisplay: false,
    editDisplay: false
  }
];

export const getDicData = (type) => {
  const map = {
    receive_rule: [
      {
        label: '超收规则',
        value: 'is_allow_overlimit'
      },
      {
        label: '重复规则',
        value: 'repeat'
      }
    ],
    outbound_rule: [
      {
        label: '滚动发料',
        value: 'roll_feeding'
      },
      {
        label: '批次出库规则',
        value: 'is_lot_required'
      },
      {
        label: '超领规则',
        value: 'is_allow_overreceive'
      },
      {
        label: '先进先出规则',
        value: 'fifo_required'
      },
      {
        label: '发料方式',
        value: 'receive_type'
      },
      {
        label: '拆包形式',
        value: 'unpacking_required'
      }
    ],
    inwarehouse_mange_rule: [
      {
        label: '保质期规则',
        value: 'storage_time'
      }
    ]
  };
  return map[type];
};
